package soundsystem.demo02;

import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Component;

@Component
public class CDPlayTest2 {

    @Autowired
    private CompactDisc cd;

    @Test
    public void method01() {
        ApplicationContext context = new AnnotationConfigApplicationContext(CDPlayerConfig.class);
        SgtPeppers sgtPeppers = (SgtPeppers) context.getBean("sgtPeppers");
        sgtPeppers.play();
    }

    @Test
    public void method02() {
        ApplicationContext context = new ClassPathXmlApplicationContext("spring/demo02/springConfig.xml");
        SgtPeppers sgtPeppers = (SgtPeppers) context.getBean("sgtPeppers");
        sgtPeppers.play();
    }



}
